package com.kuang.springcloud.controller;

import com.kuang.springcloud.pojo.Dept;
import com.kuang.springcloud.service.DeptFeignService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import java.util.List;

@RestController
public class ConsumerController {

    @Autowired
    DeptFeignService deptFeignService;

    @Autowired
    RestTemplate restTemplate;

    /**
     * 调不通
     */
    @RequestMapping("/consumer/add")
    public boolean queryDeptById(Dept dept){
        return deptFeignService.addDept(dept);
    }

    @RequestMapping("/consumer/get/{id}")
    public Dept queryDeptById(@PathVariable("id") Long id){
        return deptFeignService.queryDeptById(id);
    }

    @RequestMapping("/consumer/list")
    public List<Dept> queryDeptAll() {
        return deptFeignService.queryDeptAll();
    }

}
